//
//  KLClassify.m
//  KunLun
//
//  Created by Mac on 2017/12/14.
//  Copyright © 2017年 stoneobs@icloud.com. All rights reserved.
//

#import "KLClassify.h"

@implementation KLClassify
+ (KLClassify*)defult{
    static KLClassify * defult = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        defult = [KLClassify new];
    });
    return defult;
}
- (NSString *)titleFormNum:(NSString *)num{
    NSString * title = @"";
    for (NSDictionary * dic in self.classify) {
        if ([dic.allKeys containsObject:@"id"]) {
            NSString * dicNum = [dic[@"id"] description];
            if ([dicNum isEqualToString:num]) {
                if ([dic.allKeys containsObject:@"classify_name"]) {
                    title = dic[@"classify_name"];
                    return title;
                }
            }
        }
        

    }
    return title;
}
- (NSString *)numFormTitle:(NSString *)title{
    NSString * num = @"";
    for (NSDictionary * dic in self.classify) {
        if ([dic.allKeys containsObject:@"classify_name"]) {
            NSString * dicTitle = [dic[@"classify_name"] description];
            if ([dicTitle isEqualToString:title]) {
                if ([dic.allKeys containsObject:@"id"]) {
                    num = [dic[@"id"] description];
                    return num;
                }
            }
        }
        
        
    }
    return num;
}
@end
